<?php namespace system\database\seeds;
use houdunwang\database\build\Seeder;
use houdunwang\db\Db;
use system\model\Category;

class CategoryTableSeeder extends Seeder {
    //执行
	public function up() {
        $data = [
            [ 'cate_name'        => '了解高薪实训' ,
                'cate_description' => '了解高薪实训' ,
                'cate_sort'        => 1 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 0
            ] ,
            [ 'cate_name'        => '浓情谢师宴' ,
                'cate_description' => '浓情谢师宴' ,
                'cate_sort'        => 10 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 1,
            ] ,
            [ 'cate_name'        => '校区实景' ,
                'cate_description' => '校区实景' ,
                'cate_sort'        => 10 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 1,
            ] ,
            [ 'cate_name'        => '自学加油站' ,
                'cate_description' => '自学加油站' ,
                'cate_sort'        => 1 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 0,
            ] ,
            [ 'cate_name'        => '免费视频' ,
                'cate_description' => '免费视频' ,
                'cate_sort'        => 1 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 4,
            ] ,
            [ 'cate_name'        => '关于我们' ,
                'cate_description' => '关于我们' ,
                'cate_sort'        => 1 ,
                'cate_linkurl'     => 'http://www.houdunwang.=>com' ,
                'cate_pid'         => 0,
            ] ,
        ];
        foreach ($data as $k => $v){
            $category = new Category();
            //Category模型
            //允许填充的字段['*'],$timestamps=true
            $category->save($v);
        }

    }
    //回滚
    public function down() {
        Schema::truncate('category');
    }
}